import request from "./request";
import mockRequest from './mockAjax'
//三级菜单数据
export const reqCategoryList = () => request({
  url: '/api/product/getBaseCategoryList',
  method: 'GET'
})
//banner数据
export const reqBannerList = () => mockRequest({
  url: '/banner',
  method: 'GET'
})
//floor数据
export const reqFloorList = () => mockRequest({
  url: '/floor',
  method: 'GET'
})
//search数据
export const reqSearchInfo = (params) => request({
  url: '/api/list',
  method: 'POST',
  data: params
})
//detail数据
export const reqGoodInfo = (skuId) => request({
  url: `/api/item/${skuId}`,
  method: 'GET',
})
//加入购物车或者更新
export const reqAddOrUpdateShopCart = (skuId, skuNum) => request({
  url: `/api/cart/addToCart/${skuId}/${skuNum}`,
  method: 'POST',
})
//获取购物车列表

export const reqCartList = () => request({
  url: '/api/cart/cartList',
  method: 'GET'
})

//删除购物车

export const reqDeleteCartById = (skuId) => request({
  url: `/api/cart/deleteCart/${skuId}`,
  method: 'DELETE'
})

//修改选中状态
export const reqUpdateCheckedById = (skuID, isChecked) => request({
  url: `/api/cart/checkCart/${skuID}/${isChecked}`,
  method: 'GET'
})
//验证码
export const reqGetCode = (phone) => request({
  url: `/api/user/passport/sendCode/${phone}`,
  method: 'GET'
})

//注册
export const reqUserRegister = (data) => request({
  url: '/api/user/passport/register',
  data,
  method: 'POST',
})

//登录
export const reqLogin = (data) => request({
  url: '/api/user/passport/login',
  method: 'POST',
  data
})
//获取用户信息
export const reqUserInfo = () => request({
  url: '/api/user/passport/auth/getUserInfo',
  method: 'GET',
})
//退出登录
export const reqLogout = () => request({
  url: '/api/user/passport/logout',
  method: 'GET',
})
//获取用户地址信息
export const reqAddressInfo = () => request({
  url: '/api/user/userAddress/auth/findUserAddressList',
  method: 'GET'
})
//获取商品清单
export const reqOrderInfo = () => request({
  url: '/api/order/auth/trade',
  method: 'GET'
})
//提交订单
export const reqSubmitOrder = (tradeNo, data) => request({
  url: `/api/order/auth/submitOrder?tradeNo=${tradeNo}`,
  data,
  method: 'POST'
})

//获取订单支付信息
export const reqPayInfo = (orderId) => request({
  url: `/api/payment/weixin/createNative/${orderId}`,
  method: 'GET'
})
//获取支付订单状态
export const reqPayStatus = (orderId) => request({
  url: `/api/payment/weixin/queryPayStatus/${orderId}`,
  method: 'GET'
});

//获取个人中心的数据
export const reqMyOrderList = (page, limit) => request({
  url: `/api/order/auth/${page}/${limit}`,
  method: 'GET'
});